home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / RESTSCR.CA < prev    next >
Text File  |  1993-04-04  |  2KB  |  78 lines

  1. #include <dos.h>
  2.  
  3. rest_scr(int trow, int tcol, int brow, int bcol, char *array)
  4. /* Restore an area of the current screen that was saved via save_scr.
  5.    To determine num of chars for array use the following formula:
  6. */
  7. {
  8. extern int color, mono, cga, ega, scrseg, bios;
  9. union REGS inregs;
  10. int x, y, orow, ocol, ncols, scrofs;
  11. char pchar;
  12. char far *base;
  13. char far *work;
  14.  
  15.     if(bios) {
  16.         get_cur(&orow,&ocol);
  17.         for(x=trow; x<=brow; x++) {
  18.             for(y=tcol; y<=bcol; y++) {
  19.                 locate(x,y);
  20.                 inregs.h.bh = 0x00;
  21.                 inregs.h.ah = 0x09;
  22.                 inregs.h.al = *array++;
  23.                 inregs.h.bl = *array++;
  24.                 inregs.x.cx = 0x01;
  25.                 int86(0x10,&inregs,&inregs);
  26.             }
  27.         }
  28.         locate(orow,ocol);
  29.         return(0);
  30.     }
  31.  
  32.     if(mono) base = (char far *) 0xb0000000;
  33.     else     base = (char far *) 0xb8000000;
  34.  
  35.     ncols = bcol - tcol + 1;
  36.  
  37.     for(x=trow; x<=brow; x++) {
  38.         scrofs = ((((x + 1) * 160) - 160) + ((tcol + 1) * 2)) - 2;
  39.         work = base + scrofs;
  40.         for(y=0; y<ncols; y++) {
  41.             pchar = *array;
  42.             asm les     bx,work
  43.             asm mov     cl,pchar
  44.  
  45.             if(cga) {
  46.                 asm mov     dx,03dah
  47.                 asm in      al,dx
  48.                 asm test    al,1
  49.                 asm jnz     $-3
  50.                 asm in      al,dx
  51.                 asm test    al,1
  52.                 asm jz      $-3
  53.             }
  54.  
  55.             asm mov byte ptr es:[bx],cl
  56.             work++;  array++;
  57.  
  58.  
  59.             pchar = *array;
  60.             asm les     bx,work
  61.             asm mov     cl,pchar
  62.  
  63.             if(cga) {
  64.                 asm mov     dx,03dah
  65.                 asm in      al,dx
  66.                 asm test    al,1
  67.                 asm jnz     $-3
  68.                 asm in      al,dx
  69.                 asm test    al,1
  70.                 asm jz      $-3
  71.             }
  72.  
  73.             asm mov byte ptr es:[bx],cl
  74.             work++;  array++;
  75.         }
  76.     }
  77. }
  78.